import { defineStore } from 'pinia'

export const useAListStore = defineStore('myartistlist', {
	state: () => {
		return {
			list: {
				name:"",
				picUrl:"",
			}, 
		}
	},
	actions: {
		addProduct(name,picUrl) {
			this.list.name = name,
			this.list.picUrl = picUrl
		},
	},
	getters: {
		Listname: state => state.list.name,
		ListpicUrl: state => state.list.picUrl,
	},
     // 使用该插件，开启数据缓存
	persist: {
		//这里存储默认使用的是session
		enabled: true,
		strategies: [
			{
				//key的名称
				key: 'cartKey',
				//更改默认存储，我更改为localStorage
				storage: localStorage,
				// 可以选择哪些进入local存储，这样就不用全部都进去存储了
				// 默认是全部进去存储
				paths: ['list'],
			},
		],
	},
})
